<?php
require_once "Common/database.php";
require_once "Common/values.php";
echo '<h3>Search<p></h3>';
#echo '<p> User : '.$user ;

if ($_POST[logsearch]=='No Heffers')
{
echo '<img src="http://www.hhracing.co.uk/glam3.jpg">';
}
if ($_POST[logsearch]=='cars')
{
echo '<center><div id="wpdc_embed_12604343311" style="display: none">Exotic Cars of the Day</div><script src="http://www.widgipedia.com/embed/SATCtranscripts/Exotic-Cars-of-the-Day_5025w-12604343311t-1260434331575i-0p.js"></script></center>';
}
if ($_POST[logsearch]=='facts')
{
echo '<div id="wpdc_embed_12604356811" style="display: none">Did you know? Random Facts</div><head></head><script src="http://www.widgipedia.com/embed/agoldfinger/Did-you-know-Random-Facts_765w-12604356811t-1260435681048i-0p.js"></script>';
}
else
{
 $_POST[logsearch]='%'.$_POST[logsearch];
$result = mysql_query("SELECT * FROM tblJobs where LogNumber LIKE '$_POST[logsearch]'");

echo '<Table Border = 1 width=100%>';
echo '<tr><td>Log Number</td><td>Operator</td><td>Requestor</td><td>Subject</td></td><td>Proirty</td></td><td>Status</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '
<tr ';
colourjobs();
echo 'id="row'.$i.'" onMouseOver="row'.$i.'.style.backgroundColor=\''.$colourselector.'\';" onmouseout="row'.$i.'.style.backgroundColor=\''.$colour.'\';" onclick="location.href=\'index.php?f=helpdesk&p=hupdate&log='.$row['LogNumber'] .' \'">';
  echo '<td>'.$row['LogNumber']. "</td><td>" . $row['Operator'].'</td>'.'<td>'.$row['Requestor'].'</td><td>'.$row[Subject].'</td>'.'<td>'.$row[Proirty].'</td>'.'<td>'.$row[Status].'</td>'.'</td></tr>';
  $i=$i+1;
  }
echo '</table>';

echo '<h3>Archive search</h3>';

$result = mysql_query("SELECT * FROM tbljobsarchive where LogNumber LIKE '$_POST[logsearch]'");

echo '<Table Border = 1 width=100%>';
echo '<tr><td>Log Number</td><td>Operator</td><td>Requestor</td><td>Subject</td></td><td>Proirty</td></td><td>Status</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '
<tr ';
colourjobs();
echo 'id="row'.$i.'" onMouseOver="row'.$i.'.style.backgroundColor=\''.$colourselector.'\';" onmouseout="row'.$i.'.style.backgroundColor=\''.$colour.'\';" onclick="location.href=\'index.php?f=helpdesk&p=hupdatea&log='.$row['LogNumber'] .' \'">';
  echo '<td>'.$row['LogNumber']. "</td><td>" . $row['Operator'].'</td>'.'<td>'.$row['Requestor'].'</td><td>'.$row[Subject].'</td>'.'<td>'.$row[Proirty].'</td>'.'<td>'.$row[Status].'</td>'.'</td></tr>';
  $i=$i+1;
  }
echo '</table>';
echo '<a href="index.php">Back</a>';
}
mysql_close();

?>
